package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.KeyEvent;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public boolean onKeyUp(int keyCode, KeyEvent event) {
        char c = (char) event.getDisplayLabel();
        Toast toast;
        toast = Toast.makeText(this,"keycode:"+String.valueOf(keyCode) + "   按键:" + c,Toast.LENGTH_SHORT);
        toast.show();
        return true;
    }



}